<!--$Id: appsignals.so,v 10.28 2002/02/23 20:05:24 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB Reference Guide: Signal handling</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<a name="2"><!--meow--></a>
<table width="100%"><tr valign=top>
<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Programmer Notes</dl></b></td>
<td align=right><a href="../apprec/config.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../program/errorret.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p align=center><b>Signal handling</b></p>
<p>When applications using Berkeley DB receive signals, it is important that they
exit gracefully, discarding any Berkeley DB locks that they may hold.  This is
normally done by setting a flag when a signal arrives and then checking
for that flag periodically within the application.  Because Berkeley DB is not
re-entrant, the signal handler should not attempt to release locks and/or
close the database handles itself.  Re-entering Berkeley DB is not guaranteed to
work correctly, and the results are undefined.</p>
<p>If an application exits holding a lock, the situation is no different
than if the application crashed, and all applications participating in
the database environment must be shut down, and then recovery must be
performed.  If this is not done,  databases may be left in an
inconsistent state, or locks the application held may cause unresolvable
deadlocks inside the environment, causing applications to hang.</p>
<p>Berkeley DB restarts all system calls interrupted by signals, that is, any
underlying system calls that return failure with errno set to EINTR will
be restarted rather than failing.</p>
<table width="100%"><tr><td><br></td><td align=right><a href="../apprec/config.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../program/errorret.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>
